<?php
header('Content-Type: text/html;charset=utf-8');
/*
	更新记录：
		2015-05-13 创建
		2016-07-29 更新
		2017-06-01 完善
*/
require '../../vendor/autoload.php';

use database\DnFile;
use utils\PathTool;
use model\DnFileInf;

$uid 	 = $_GET["uid"];
$cbk	 = $_GET["callback"];
$id 	 = $_GET["id"];
$nameLoc = $_GET["nameLoc"];
$pathLoc = $_GET["pathLoc"];
$sizeSvr = $_GET["sizeSvr"];
$nameLoc = PathTool::url_decode($nameLoc);
$pathLoc = PathTool::url_decode($pathLoc);
$sizeSvr = PathTool::url_decode($sizeSvr);

if (   strlen($uid) < 1
	|| empty($id)
	|| empty($pathLoc)
	)
{
	echo 0;
	return;
}

$f          = new DnFileInf();
$f->id		= $id;
$f->uid     = $uid;
$f->nameLoc = $nameLoc;
$f->pathLoc = $pathLoc;
$f->sizeSvr = $sizeSvr;
$f->fdTask  = true;
$db         = new DnFile();
$db->Add($f);

$f->nameLoc = PathTool::urlencode_safe($f->nameLoc);
$f->pathLoc = PathTool::urlencode_safe($f->pathLoc);
$json = json_encode($f);
$json = urldecode($json);//还原汉字
$json = urlencode($json);
$json = "$cbk({\"value\":\"$json\"})";//返回jsonp格式数据。
echo $json;
?>